/****************************************************************
 * Fulguro
 * Copyright (C) 2004 Christophe Clienti
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 ***************************************************************/

%module (docstring="Fulguro Realtime Display Module") flgrrtcapture
%include "typemaps.i"

%include ../common/common.i

%inline %{

#include <flgrCoreTypes.h>
#include <flgrCoreErrors.h>
#include <flgrCoreData.h>
#include <flgrRtCapture.h>

%}


typedef struct {
}FLGR_RtCapture2D;

%extend FLGR_RtCapture2D {
  FLGR_RtCapture2D(char *videodev) {
    return flgr2d_rtcapture_create(videodev);
  }

  ~FLGR_RtCapture2D() {
    flgr2d_rtcapture_destroy($self);
  }

  FLGR_Ret set_palette(char *palette) {
    return flgr2d_rtcapture_set_palette($self, palette);
  }

  char *get_palette() {
    return flgr2d_rtcapture_get_palette($self);
  }

  SwigObject get_size() {
    int x=0,y=0;
    SwigObject obj = SwigObjectEmpty;   
 
    obj = SwigCreateArray(2);
    flgr2d_rtcapture_get_window_size($self, &x,&y);
    
    SwigSetArrayVal( obj, 0, SwigInt_FromCInt(x) );
    SwigSetArrayVal( obj, 1, SwigInt_FromCInt(y) );
    return obj;
  }

  FLGR_Ret set_size(int x, int y) {
    flgr2d_rtcapture_set_window_size($self,x,y);
  }
};

/*********************** Documentation ***********************/
%feature("autodoc","""
[in] String
[return] FLGR_RtCapture2D\n
Initialize the video capture device by using the path/file given (eg /dev/videoO)
""") flgr2d_rtcapture_create;

%feature("autodoc","""
[in] FLGR_RtCapture2D
[return] nothing\n
Destruct the video capture device class
""") flgr2d_rtcapture_destroy;

%feature("autodoc","""
[in] FLGR_RtCapture2D
[return] String\n
Return the palette used by the device (eg RGB24)
""") flgr2d_rtcapture_get_palette;

%feature("autodoc","""
[in] FLGR_RtCapture2D
[in] String
[return] FLGR_RET_OK, ...\n
Set the palette defined in the String in the video capture device
""") flgr2d_rtcapture_set_palette;

%feature("autodoc","""
[in] FLGR_RtCapture2D
[in] Width (integer)
[in] Height (integer)
[return] FLGR_RET_OK, ...\n
Change the size of the capture window
""") flgr2d_rtcapture_set_window_size;

%feature("autodoc","""
[in] FLGR_RtCapture2D
[return] [<FLGR_RET_OK,...> , Width, Height]\n
Get the size of the capture window
""") flgr2d_rtcapture_get_window_size;

%feature("autodoc","""
[out] FLGR_Data2D
[in] FLGR_RtCapture2D
[return] FLGR_RET_OK, ...\n
Capture a gray image from the video capture device
""") flgr2d_rtcapture_gray_image;


/*********************** Functions ***********************/
FLGR_RtCapture2D *flgr2d_rtcapture_create(char *);
FLGR_Ret flgr2d_rtcapture_gray_image(FLGR_Data2D *imin, FLGR_RtCapture2D *viddev);
 
